package kr.co.doriclassic.powerjava.chapter12.interfaceex;

public class Box2 implements Comparable2 {
	private double volume;
	public Box2(double volume) {
		this.volume = volume;
	}

	@Override
	public int compareTo(Object other) {
		return (int) (volume-((Box2)other).volume);
	}
	
	public static void main(String[] args) {
		Box b1 = new Box(10);
		Box b2 = new Box(20);
		
		System.out.println(b1.CompareTo(b2));
		
		if(b1.CompareTo(b2)>0){
			System.out.println("b1이 큼");
		}
		else if(b1.CompareTo(b2)<0){
			System.out.println("b2가 큼");
		}
		else{
			System.out.println("같음");
		}
	}
	
}
